package com.hducms.cms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hducms.cms.dao.ContentCheckDao;
import com.hducms.cms.entity.main.Content;
import com.hducms.cms.entity.main.ContentCheck;
import com.hducms.cms.service.ContentCheckService;

@Service
@Transactional
public class ContentCheckServiceImpl implements ContentCheckService {
	public ContentCheck save(ContentCheck check, Content content) {
		check.setContent(content);
		check.init();
		dao.save(check);
		content.setContentCheck(check);
		return check;
	}

	public ContentCheck update(ContentCheck bean) {
		dao.update(bean);
		return bean;
	}

	private ContentCheckDao dao;

	@Autowired
	public void setDao(ContentCheckDao dao) {
		this.dao = dao;
	}

	@Override
	public ContentCheck findById(Integer id) {
		return dao.findById(id);
	}
}